package com.yby6.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yby6.common.core.domain.SysUser;
import com.yby6.system.vo.SysUserVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * ClassName: Loginfo
 * Description: 杨不易网站 :www.yangbuyi.top
 * date: 2021/5/13
 *
 * @author TeouBle
 * @author Yang Shuai
 * @since JDK 1.8
 **/

public interface SysUserMapper extends BaseMapper<SysUser> {
	/**
	 * delete by primary key
	 *
	 * @param id primaryKey
	 * @return deleteCount
	 */
	int deleteByPrimaryKey(@Param("id") Long[] id);

	/**
	 * insert record to table
	 *
	 * @param record the record
	 * @return insert count
	 */
	int insert(SysUser record);

	/**
	 * select by primary key
	 *
	 * @param id primary key
	 * @return object by primary key
	 */
	SysUser selectByPrimaryKey(Long id);

	/**
	 * update record selective
	 *
	 * @param record the updated record
	 * @return update count
	 */
	int updateByPrimaryKeySelective(SysUser record);

	/**
	 * update record
	 *
	 * @param record the updated record
	 * @return update count
	 */
	int updateByPrimaryKey(SysUser record);

	/**
	 * 用户登陆逻辑
	 *
	 * @param usernamePasswordToken
	 */
	SysUser getUserNameByPassword(@Param("username") String username, @Param("password") String password);

	/**
	 * 启用用户
	 *
	 * @param id
	 * @param status
	 * @return
	 */
	int enabled(@Param("id") Long id, @Param("status") Long status);

	/**
	 * 分页查询用户数据列表
	 *
	 * @param sysUser
	 * @return
	 */
	List<SysUser> list(SysUser sysUser);

	/**
	 * 根据ID查询用户信息
	 *
	 * @param id
	 * @return
	 */
	SysUserVo getById(Long id);

	/**
	 * 根据用户openId查询用户
	 * @param openid
	 * @return 用户
	 */
	SysUser getUserByOpenId(String openid);

	/**
	 * 根据openId更新头像、昵称
	 * @param sysUserVo
	 */
	int updateByOpenId(SysUserVo sysUserVo);

	/**
	 * 根据人脸ID查询用户信息
	 * @param faceId
	 * @return
	 */
    SysUser getUserInfoByFaceId (String faceId);

	/**
	 * 根据用户id获取用户角色
	 * @param id
	 * @return roles
	 */
	List<String> selectRolesByUserId (Long id);
}